Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor helidon config 4.0 #4776

Merged
merged 5 commits into from
Sep 7, 2022
Merged

Conversation

trentjeff
Copy link
Member

Fix for #4764

@trentjeff trentjeff added the 4.x Version 4.x label Aug 23, 2022
@trentjeff trentjeff requested a review from tomas-langer August 23, 2022 21:30
@trentjeff trentjeff self-assigned this Aug 23, 2022
@romain-grecourt
Copy link
Contributor

/oca-checked

@romain-grecourt
Copy link
Contributor

/trigger

@romain-grecourt
Copy link
Contributor

Can we separate pico into its own dedicated PR ?

pico/LICENSE.txt Outdated Show resolved Hide resolved
config/config/pom.xml Show resolved Hide resolved
pico/config/pom.xml Outdated Show resolved Hide resolved
pico/config/pom.xml Outdated Show resolved Hide resolved
pico/pom.xml Outdated Show resolved Hide resolved
pico/pom.xml Outdated Show resolved Hide resolved
integrations/cdi/datasource/pom.xml Show resolved Hide resolved
@romain-grecourt romain-grecourt changed the title pr-4764 - refactor helidon config 4.0 Refactor helidon config 4.0 Aug 24, 2022
@romain-grecourt
Copy link
Contributor

/trigger

pico/api/pom.xml Outdated
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<scope>compile</scope>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand idea of this.
Starting with 4.x jakarta.* annotations will be required for SE ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jakarta.inject module is needed (as compile scope) for the definition of the Provider class, sadly in the same package with other annotations that would otherwise only be needed as provided scope.

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2017, 2022 Oracle and/or its affiliates.
Copyright (c) 2022 Oracle and/or its affiliates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong copyright change. It must be 2017, 2022. Please revert this change

import java.util.Map;

/**
* <h2>Configuration</h2>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding headers to javadocs is tricky and not really needed here, when we have a single sentence description

* @return current config node key
* @see #name()
*/
BaseKey key();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseKey? This should return Key. Our API should be Key, BaseKey I would expect to be an abstract class I can extend, not API

* @return {@code true} if the node is existing leaf node, {@code false}
* otherwise.
*/
boolean isLeaf();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really needed. This is basically !isObject() && !isKey() && hasValue().
Also method hasValue() is missing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no isKey() on either common/config/Config or config/config. I will add hasValue() decl on common/config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, meant isList() not isKey()

* @return a typed list with values
* @throws io.helidon.common.config.ConfigException in case of problem to map property value.
*/
default <T> ConfigValue<List<T>> asList(Class<T> type) throws ConfigException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not have a default implementation. Esp. not an implementation like this

*
* @see Config#key()
*/
interface BaseKey extends Comparable<BaseKey> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be named Key. BaseKey would mean an abstract class. Also this is one of the main APIs of Config, so not prefixes should be used.

* @throws IllegalStateException in case you attempt to call this method on a root node
* @throws io.helidon.common.config.ConfigException if not defined
*/
default BaseKey parent() throws ConfigException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add default implementations like this

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2017, 2022 Oracle and/or its affiliates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright should be just 2022, this file did not exist in 2017

common/pom.xml Outdated
<module>configurable</module>
<module>reactive</module>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this reordered? Please simplify the change

@@ -83,5 +83,20 @@
<Method name="parse"/>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
</Match>
<Match>
<!-- Path shadows common/config -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does Path mean in these descriptions? I do not understand this explanation

Copy link
Member

@tomas-langer tomas-langer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@trentjeff trentjeff merged commit a4a092c into helidon-io:main Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants